/**
 * Description
 *
 * Creation Date 18/12/2017
 * @author Candy
 */
import React, { PureComponent } from 'react';
import { View, Image, StyleSheet, Text, TouchableOpacity } from 'react-native';
import { screen, config, color } from '../utils';
import * as TextTool from './TextTool';

const { H1, Small, Normal, H3, tip } = TextTool

export default class GridItem extends PureComponent {
	constructor(props) {
		super(props)
	}

	render() {
		const { item } = this.props;
		return (
			<TouchableOpacity style={[styles.container, this.props.style]} onPress={this.props.onPress}>
				<Image style={styles.brandImage} resizeMode='stretch'
						source={{uri: config.productBaseUrl + item.product_image + '?param=200y100'}} />
				<View>
					<Text numberOfLines={2} style={{borderColor: 'red', width: screen.width - 210}}>{item.product_name}</Text>
					<Text style={styles.price}>￥{item.price}</Text>
				</View>
			</TouchableOpacity>
		)
	}
}

const styles = StyleSheet.create({
	container: {
		flex:1,
		flexDirection: 'row',
		backgroundColor: '#fff',
		alignItems: 'center'
	},
	brandImage: {
		width: 200,
		height: 100
	},
	price: {
		fontSize: 20,
		fontWeight: 'bold',
		color: color.theme
	}
});